﻿using System.Collections.Generic;
using Application.DTO;

namespace MvcPresentation.Models
{
    public class CustomerMapper
    {
        public IEnumerable<Customer> From(IEnumerable<CustomerInfo> customers)
        {
            foreach (var item in customers)
            {
                yield return From(item);
            }
        }

        public Customer From(CustomerInfo item)
        {
            return new Customer {CustomerId = item.CustomerId, FirstName = item.FirstName, LastName = item.LastName};
        }

        internal CustomerInfo From(Customer customer)
        {
            return new CustomerInfo() { CustomerId = customer.CustomerId, FirstName = customer.FirstName, LastName = customer.LastName };
        }

      
    }
}